﻿using FF14TreasureDiggingTool.ViewModels;
using System;
using System.Windows.Controls;
using FF14TreasureDiggingTool.Views.Pages;
using Wpf.Ui.Controls;
using Wpf.Ui.Controls.Interfaces;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;

namespace FF14TreasureDiggingTool.Views.Windows;

/// <summary>
/// CustomRuleWindow.xaml 的交互逻辑
/// </summary>
public partial class CustomRuleWindow 
{
    private readonly IPageService _pageService;
    private readonly INavigationService _navigationService;
    private readonly ISnackbarService _snackbarService;
    private readonly IDialogService _dialogService;
    public CustomRuleWindowViewModel ViewModel { get; }
    
    public CustomRuleWindow(CustomRuleWindowViewModel viewModel,IPageService pageService, INavigationService navigationService,ISnackbarService snackbarService, IDialogService dialogService)
    {
        _pageService = pageService;
        _navigationService = navigationService;
        _snackbarService = snackbarService;
        _dialogService = dialogService;

        ViewModel = viewModel;
        DataContext = this;
        InitializeComponent();
        _navigationService.SetNavigationControl(RootNavigation);

        _navigationService.SetPageService(_pageService);
        _dialogService.SetDialogControl(RootDialogC);
        _snackbarService.SetSnackbarControl(RootSnackbarC);

    }

    protected override void OnActivated(EventArgs e)
    {
        base.OnActivated(e);

        _dialogService.SetDialogControl(RootDialogC);
        _snackbarService.SetSnackbarControl(RootSnackbarC);
    }
}